﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Configuration;

namespace XMK.Framework.ElasticSearch
{
    public class ElasticSearchConnection
    {
        public string HostIP
        {
            get;
            private set;
        }

        public int Port
        {
            get;
            private set;
        }

        public ConnectionType ConnType
        {
            get;
            private set;
        }

        public string Database
        {
            get;
            private set;
        }

        public ElasticSearchConnection(string hostIp, int port, string database, ConnectionType connType)
        {
            HostIP = hostIp;
            Port = port;
            ConnType = connType;
            Database = database;
        }

        public ElasticSearchConnection(string hostIp, int port, string database)
            : this(hostIp, port, database, ConnectionType.Http)
        {

        }

        public ElasticSearchConnection(string hostIp, string database)
            : this(hostIp, 9200, database)
        {

        }

        public string GetUri()
        {
            return string.Format("http://{0}:{1}", HostIP, Port);
        }

        
    }

    public enum ConnectionType
    {
        Http,
        Thrift
    }
}
